package title;

/**
 * @author 111
 * @version 1.0
 * @date 2025/4/14 19:58
 * @description
 */
public class Test06 {

    public void test01() {
        String str = "noon";
        System.out.println(str);
        StringBuilder s = new StringBuilder(str);
        String string = s.reverse().toString();
        System.out.print("回文数：");
        if(str.equals(string)){
            System.out.println(true);
        }else{
            System.out.println(false);
        }
    }


    public void test02() {
        String str = "noon";
        System.out.println(str);
        char[] arr = str.toCharArray();
        boolean flag = true;
        for (int left = 0,right=arr.length-1; left <=right; left++,right--) {
            if(arr[left] != arr[right]){
                flag = false;
                break;
            }
        }
        System.out.print("回文数：");
        if(flag){
            System.out.println(true);
        }else{
            System.out.println(false);
        }
    }
}
